package com.mall.mapper;

import com.github.pagehelper.PageHelper;
import com.mall.dto.FrontOrderDto;
import com.mall.dto.OmsOrderDetail;
import com.mall.entity.OmsOrder;
import com.mall.dto.OmsOrderDeliveryParam;
import com.mall.dto.OmsOrderQueryParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author zzx
 * @since 2022-06-15
 */
@Mapper
public interface OmsOrderMapper extends BaseMapper<OmsOrder> {
    /**
     * 条件查询订单
     */
    List<OmsOrder> getList(@Param("queryParam") OmsOrderQueryParam queryParam);

    /**
     * 批量发货
     */
    int delivery(@Param("list") List<OmsOrderDeliveryParam> deliveryParamList);

    /**
     * 获取订单详情
     */
    OmsOrderDetail getDetail(@Param("id") Long id);

    @Select("select id from oms_order where id = (select Max(id) from oms_order) limit 1")
    Long getMaxId();

    /**
     * 根据用户id获取订单
     */
    List<FrontOrderDto> getFrontOrderList(@Param("memberId") Long memberId);

}
